package nodes.command;

import java.util.List;
import parser.ParserException;
import model.Model;
import model.Turtle;
import nodes.AbstractNode;
import nodes.VariableNode;


/**
 * Returns :true if the first active turtle's pen is down, :false if it is up
 */
public class ShowingpC extends AbstractCommand
{
    public AbstractNode evaluate (List<AbstractNode> myArguments, Model model)
    {
        if (myArguments.size() != Integer.parseInt(resources.getString("showingp")))
        {
            throw ParserException.BAD_ARGUMENTS;
        }

        Turtle turtle = model.getActiveTurtles().get(0);
        
        if(turtle.getVisibility() == true) return new VariableNode(TRUE_VARIABLE_NAME,model);
        else return new VariableNode(FALSE_VARIABLE_NAME,model);

    }
}
